package com.demo.mapper;

import com.demo.entity.Dept;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface DeptMapper {

    @Select("select dept_id deptId,dept_name deptName from dept")
    List<Dept> selectAllDept();

    @Select("select dept_id deptId,dept_name deptName from dept where dept_id=#{id}")
    Dept selectDeptById(int id);

    @Delete("delete from dept where dept_id=#{id}")
    int deleteDeptById(int id);

    @Insert("insert into dept(dept_name) values (#{deptName})")
    int insertDept(Dept dept);

    @Update("update dept set dept_name=#{deptName}")
    int updateDept(Dept dept);


}
